/**
 *
 * @author bwolff
 */

package coffee;

import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Random;

public class Coffee {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        
        
        User user = new User("Hans",120, "C1-234");
        int id = user.getId();
        ArrayList<Statistics> statistic = user.getStatistic();
        
        Timestamp ts = Timestamp.valueOf("2013-12-17 10:10:10.0");
        statistic.add(new Statistics(ts.getTime(), Constants.CAPPUCCINO, 180,80));
        ts = Timestamp.valueOf("2013-12-17 11:13:10.0");        
        statistic.add(new Statistics(ts.getTime(), Constants.CAPPUCCINO, 180,80));
        ts = Timestamp.valueOf("2013-12-17 12:10:10.0");        
        statistic.add(new Statistics(ts.getTime(), Constants.CAPPUCCINO, 180,80));
        ts = Timestamp.valueOf("2013-12-15 12:10:10.0");        
        statistic.add(new Statistics(ts.getTime(), Constants.CAPPUCCINO, 180,80));
        ts = Timestamp.valueOf("2013-12-15 12:10:10.0");        
        statistic.add(new Statistics(ts.getTime(), Constants.CAPPUCCINO, 180,80));
        ts = Timestamp.valueOf("2013-12-17 12:20:10.0");        
        statistic.add(new Statistics(ts.getTime(), Constants.CAPPUCCINO, 180,80));
        user.setStatistic(statistic);
        user.saveUser();
        user = new User(id);
        //user.print();
        
        CaffeineLevel cl = new CaffeineLevel();
        int weight = 72;
        int caffeine = 480;
        double level = cl.getCaffeineLevel(weight, caffeine);
        //System.out.printf("Weight %d, Caffeine %d Level %f", weight, caffeine,level);
        
        ts = Timestamp.valueOf("2013-12-17 10:10:10.0");
        int sum = user.getCoffeinSum24();
        //System.out.println("sum: "+sum);
        
        ArrayList<String[]> drinkList = new ArrayList<>();
        Timestamp tStamp = new Timestamp(System.currentTimeMillis());
        long tsNow = tStamp.getTime();
        long ts2 = tsNow - 60*60*24*1000;
        drinkList = user.getDrinkList(ts2);
        
        System.out.println("DrinkList"+drinkList.toString());
        /*
        CoffeeModel cm = new CoffeeModel();
        CodeTranslator ct = new CodeTranslator();
        cm.c.sendCommand(new int[] { Constants.MAKE, Constants.GREEN_TEA,
					Constants.MEDIUM_CUP, 80, 180000 });
        //cm.makeCoffee(Constants.ARABICA, Constants.SMALL_CUP, true, Constants.CARAMEL);
        //cm.makeEspresso(Constants.SMALL_CUP, Constants.CARAMEL);        
        try {
				Thread.sleep(2500);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
       //cm.makeGreenTea(Constants.BIG_CUP, 80, 3000);
       //dacm.fillAll();
         
       while (true) {
            while (!cm.c.readStream.queue.isEmpty()){                                
                System.out.println(ct.translateCommand(cm.c.readStream.queue.poll()));
                //System.out.println(cm.c.readStream.queue.poll());
            }
        }*/
    }
    
}
